<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .style1 {
        color: red;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <!-- 对象绑定 -->
      <div :class="div1" @click="click1">对象绑定</div>
      <!-- 数组绑定 -->
      <div :class="div2" @click="click2">数组绑定</div>
      <!-- 样式绑定 -->
      <div :style="div3">样式绑定</div>
    </div>
    <script src="js/vue.js"></script>
    <script>
      const vue = new Vue({
        el: "#app",
        data: {
          div1: {
            style1: true,
          },
          div2: ["style1"],
          div3: {
            color: "blue",
          },
        },
        methods: {
          click1() {
            const cur = this.div1.style1;
            console.log(cur);
            this.div1.style1 = !cur;
          },
          click2() { }
        },
      });
    </script>
  </body>
</html>
